package test6;//主程序类，定义两个时钟对象，输入一个时间值，初始化时钟对象1，然后输出两个时钟的值。
//请在下面的【】处补充代码。

import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        Container[] containers = new Container[n];
        int k=0;
        for(int i=0;i<n;i++) {
            String s = sc.next();
            if( s.equals("cube")) {
                double len = sc.nextDouble();
                containers[k++] = new Cube(len);
            } else if( s.equals("cylinder")) {
                double r = sc.nextDouble();
                double h = sc.nextDouble();
                containers[k++] = new Cylinder(r,h);
            }
        }

        System.out.printf("%.2f\n", Container.sumofArea(containers));
        System.out.printf("%.2f", Container.sumofVolume(containers));

    }
}

